﻿using System.ComponentModel;
using CSW.Framework.Common;

namespace LinqBusinessObjectBuilder.ProjectInfo
{
    internal class SerializationMode
    {
        private static readonly SerializationMode m_None;
        private static readonly SerializationMode m_Unidirectional;
        private static readonly ReadOnlyBindingList<SerializationMode> m_List;

        private readonly string m_Name;

        static SerializationMode()
        {
            m_None = new SerializationMode("None");
            m_Unidirectional = new SerializationMode("Unidirectional");

            m_List = new ReadOnlyBindingList<SerializationMode>
                         {
                             m_None, 
                             m_Unidirectional
                         };

            m_List.MakeReadOnly();
        }

        private SerializationMode(string name)
        {
            Guard.ArgumentNotNullOrEmptyString(name, "name");

            m_Name = name;
        }

        public string Name
        {
            get { return m_Name; }
        }

        public override string ToString()
        {
            return m_Name;
        }

        public static SerializationMode None
        {
            get { return m_None; }
        }

        public static SerializationMode Unidirectional
        {
            get { return m_Unidirectional; }
        }

        public static BindingList<SerializationMode> GetAll()
        {
            return m_List;
        }
    }
}